package laMalinche.testingPlayGround.aspect;

import java.lang.reflect.Field;

/**
 * Created by IntelliJ IDEA.
 * User: ranran
 * Date: Aug 5, 2009
 * Time: 7:15:08 PM
 * To change this template use File | Settings | File Templates.
 */
public class ReflectionUtils {
    public static String getPropertyFromAccessor(String  s) {
       return  s.replaceFirst("set","");
    }

    public static Object invokeAccessor(Object o, String property) {
        Object o1 = null;
        try {
            Field field = null;
            field = o.getClass().getDeclaredField(property);
             o1 = field.get(o);
        } catch (Exception e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        return o1;
    }
}
